package dome4Map;

import java.util.*;

public class Mapdome2 {
    public static void main(String[] args) {
        //掌握Map的一些常用方法
        Map<String,Integer> map=new HashMap<>();
        map.put("张三",23);
        map.put("李四",24);
        map.put("王五",25);
        map.put("赵六",26);
        map.put("赵六",27);
        map.put("陈世玉",18);
        System.out.println(map);
        //演示一些常用方法
        System.out.println(map.get("陈世玉"));
        System.out.println(map.containsKey("张三"));
        System.out.println(map.containsValue(23));
        System.out.println(map.remove("张三"));
        System.out.println(map);
        System.out.println(map.size());
        System.out.println(map.isEmpty());
        //map.clear();
        System.out.println(map);
        //map.keySet().forEach(key-> System.out.println(key));//lamdba方式
        Set<String> keys=map.keySet();
        for (String key:keys){
            System.out.println(key);
        }
        Collection<Integer> values=map.values();
        for(Integer value:values) {
            System.out.println(value);
        }
    }
}
